<?php
include("admin/sesiune.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Cos</title>
</head>
<body>
<?php
$username = $_SESSION["username"];
$pret = $_POST['pret'];
$numeProd = $_POST['numeProd'];
$query ="SELECT p.numeProd, p.pret FROM cos c INNER JOIN produse p on c.ID = p.ID WHERE c.username = '$username'";
$showProd = mysql_query($query,getConnection()) or die (mysql_error());
$nr = mysql_num_rows($showProd);

if($nr>0)
	{
		while ($displayProd= mysql_fetch_array($showProd)) 
		{	
			echo "<table><tr><td>Produs</td><td>$displayProd[numeProd]</td></tr><tr><td>Pret</td><td>$displayProd[pret]</td></tr></table>"."<br/>"; 
		}		
	}
		elseif($_SESSION["username"])
		{
			echo "<div style='background:red;color:white;font-weight:bold;'>Nu exista produse</div>";
		}
?>
<form action="trimite.php"  method="post">
<input type="hidden" name="username" value="<?php echo $displayProd["$username"];?>" >
<?php if(isset($_SESSION["username"]))
	{
		echo '<input type="submit" name = "trimite" value="Trimite comanda">';
	}
else
	{	
		echo "Log in to add in cart! (free sign up!!!)";
	}
?>
</form>
</body>
</html>